package main

import (
	"flag"
	"fmt"
	"helloDicer/logger"
	"os"
	"time"
)

/*
 * @Description: 无
 * @version: 1.0.0
 * @Company: sdbean
 * @Author: hammercui
 * @Date: 2019-10-30 16:51:11
 * @LastEditors: hammercui
 * @LastEditTime: 2019-11-04 10:20:09
 */

var cliFlag int
var cliName string
var help bool

func init() {
	flag.BoolVar(&help, "h", false, "this help")
	flag.IntVar(&cliFlag, "f", 1111, "the value of cliFlag")
	flag.StringVar(&cliName, "na", "default", "the value of cliName")
	flag.Usage = usage
	//解析命令行参数
	flag.Parse()
	if help {
		flag.Usage()
	}
}

func main() {

	logger.SetInit(true)
	logger.Debug("test logger!!!!!!!!!!!!!!!")
	time.Sleep(time.Second)
	fmt.Println("hello my name is helloDocker")


	fmt.Printf("args=%s, num=%d\n", flag.Args(), flag.NArg())
	fmt.Println("cliFlag", cliFlag)
	time.Sleep(time.Second)
}

func usage() {
	fmt.Fprintf(os.Stderr, `helloDocker version: helloDocker/1.10.0
Usage: helloDocker [-hvVtTq] [-s signal] [-c filename] [-p prefix] [-g directives]

Options:
`)
	flag.PrintDefaults()
}
